package com.yunji.hushuang.plugin.demo;

import com.yunji.hushuang.plugin.InterceptorChain;
import com.yunji.hushuang.plugin.demo.interceptor.LogInterceptor;
import com.yunji.hushuang.plugin.demo.interceptor.TimeInterceptor;
import com.yunji.hushuang.plugin.demo.source.DemoParam;
import com.yunji.hushuang.plugin.demo.source.DemoTarget;
import com.yunji.hushuang.plugin.demo.source.IExecutor;

/**
 * @author hushuang
 * @since 2019/10/16
 */
public class PluginTest {

    public static void main(String[] args) {
        InterceptorChain chain = new InterceptorChain();

        chain.addInterceptor(new TimeInterceptor());
        chain.addInterceptor(new LogInterceptor());

        IExecutor executor = (IExecutor) chain.pluginAll(new DemoTarget());
        executor.execute(new DemoParam("admin"));
    }
}
